﻿using System;
using System.Collections;
using System.Data;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.SessionState;
using System.Configuration;
using System.Data.SqlClient;
using Rison.BusinessFacade.Common;
using Rison.DataAccess.Data.ZJCP;

namespace Rison.Web.ZJCP.ashx
{
    /// <summary>
    /// $codebehindclassname$ 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class load_depart_info : IHttpHandler, IRequiresSessionState
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/javascript";
            context.Response.Write(String.Format("_departInfo = {0};" ,loadDepartInfo() ));
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
        private string loadDepartInfo()
        {
            string sql = String.Format("select t1.depart_id,t3.DepartName, t4.FieldTotal, t4.FieldNum, t5.FieldTotal as t5total, t5.FieldNum as t5num from ExpertDepart t1, Expert t2, Department t3, SelfExamination t4, NRBZ_Master t5 where t1.ex_id=t2.ex_id and t1.depart_id=t3.DepartID and t1.depart_id=t4.DepartID and t1.depart_id=t5.DepartID and t2.ex_user_name='{0}' order by t3.DepartName", CurrentLoginedUser.UserName);
            DataSet ds = DbAccess.executeQuery(sql);
            return JsonCommon.ds2json(ds);
        }
 
    }
}
